<template>
  <div style="position:relative">
    <div class="hearder">当前有{{appointmentInfo.length? appointmentInfo.length-1:0}}人等就诊人候 
      <!-- <a @click="nextpatient">切换下一位就诊人(此就诊人默认结束就诊)</a>  -->

          <el-popconfirm
      title="确认结束当前会诊吗?"
      @onConfirm="nextpatient"
    >
      <el-button slot="reference" plain size="mini">切换下一位就诊人(无病人结束就诊)</el-button>
</el-popconfirm>
<el-popconfirm style="position: absolute;
  right: 100px;
  top: 0;"
      title="确认结束今天会诊吗?"
      @onConfirm="deleteallpat"
    >
      <el-button slot="reference" type="primary" size="mini">结束就诊</el-button>
</el-popconfirm>

    </div>
    <div class="cardWarp" v-if="appointmentInfo.length">
      <LeftCard  />
      <inquiryTable />
    </div>
    <div v-else class="nonepat">暂无就诊人</div>
  </div>
</template>

<script>
import LeftCard from "./leftCard";
import inquiryTable from './inquiryTable'
import {mapState,mapMutations} from "vuex"
export default {
  name: "inquiry",
  components: {
    LeftCard,
    inquiryTable
  },
  computed:{
    ...mapState({
      appointmentInfo:state=>state.appointment.appointmentInfo
    })
  },
  methods:{
    ...mapMutations([
      "nextpatient",
      "clearPatient"
    ]),
    // 结束就诊的回到
    deleteallpat(){
      this.clearPatient()
    }
    
  }
};
</script>

<style lang="less" scoped>
.hearder {
  position: relative;
  margin: 10px 20px;
  font-size: 14px;
  height: 30px;
  a {
    color: cornflowerblue;
    margin-left: 10px;
    cursor: pointer;
  }
}
.cardWarp {
  display: flex;
}
.finish{
  position: absolute;
  right: 100px;
  top: 0;
}
.nonepat{
  position:absolute;
  font-size:30px;
  text-align: center;
  width:100%;
  line-height: 50px;
}
</style>
